package com.xjrh.traintravel.collector.api;

import com.xjrh.common.core.web.AjaxResult;
import com.xjrh.traintravel.collector.api.param.Equipment;
import com.xjrh.traintravel.collector.netty.command.check.CheckData;
import com.xjrh.traintravel.collector.netty.command.mvb.MvbData;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;

/**
 * 业务服务-列车信息
 *
 * @author snps
 * @create 2022-03-11 15:13
 * @describe
 **/
@FeignClient(value = "business-train", fallbackFactory = BusinessTrainServiceFallbackFactory.class)
public interface BusinessTrainService {

    /**
     * 修改设备信息
     */
    @PostMapping({"/equipment/update"})
    public AjaxResult update(@RequestBody Equipment entity);

    /**
     * 通过mac地址修改设备信息
     */
    @PostMapping({"/equipment/updateByMacAddr"})
    public AjaxResult updateByMacAddr(@RequestBody Equipment entity);

    /**
     * 修改网络状态
     */
    @PostMapping({"/equipment/setNetStatus"})
    public AjaxResult setNetStatus(@RequestParam(value="equipmentMacAddr") String equipmentMacAddr,
                                   @RequestParam(value="netStatus") Integer netStatus,
                                   @RequestParam(value="version", required = false) String version);

    /**
     * 设置全部设备为离线状态
     */
    @PostMapping({"/equipment/setAllOffLine"})
    public AjaxResult setAllOffLine();

    /**
     * 保存重启日志
     */
    @PostMapping("/equipment/upgrade/saveRestartLogs")
    public AjaxResult saveRestartLogs(@RequestParam(value="equipmentMacAddr") String equipmentMacAddr,
                                      @RequestParam(value="datetime") Date datetime, @RequestParam(value="result") Integer result);

    /**
     * 保存自检模式上报数据
     */
    @PostMapping({"/equipment/upgrade/saveCheckData"})
    public AjaxResult saveCheckData(@RequestBody CheckData entity);

    /**
     * 保存MVB上报数据
     */
    @PostMapping({"/equipment/mvb/saveData"})
    public AjaxResult saveMvbData(@RequestBody MvbData entity);


}